package deng.jboss.examples.ejbwithlib;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJB;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.log4j.Logger;


/**
 * @author Zemian Deng
 *
 */

@MessageDriven(
	messageListenerInterface = MessageListener.class,
	activationConfig = { 
		@ActivationConfigProperty(propertyName = "destination", propertyValue = "/queue/ExampleQueue"),
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
	}
)
public class Load3rdPartyLibMsgBean implements MessageListener {

	private static Logger logger = Logger.getLogger(Load3rdPartyLibMsgBean.class);
			
	@Override
    public void onMessage(Message message) {
		logger.trace("Received message: " + message);
		String msgStr = ToStringBuilder.reflectionToString(message);
		logger.debug("Processing " + msgStr);
    }
}
